﻿(function ($) {
    $.extend(String.prototype, {
        isPositiveInteger: function () {
            return (new RegExp(/^[1-9]\d*$/).test(this));
        },
        replaceAll: function (os, ns) {
            return this.replace(new RegExp(os, "gm"), ns);
        }
    });
    $.fn.extend({
        hoverClass: function (className) {
            var _className = className || "hover";
            return this.each(function () {
                $(this).hover(function () {
                    $(this).addClass(_className);
                }, function () {
                    $(this).removeClass(_className);
                });
            });
        }
    });
})(jQuery);

var DWZ = {
    frag: {},
    init: function (pageFrag) {
        $.ajax({
            type: 'GET',
            url: pageFrag,
            dataType: 'xml',
            timeout: 600,
            cache: false,
            error: function (xhr) {
                alert('Error loading XML document: ' + pageFrag + "\nHttp status: " + xhr.status + " " + xhr.statusText);
            },
            success: function (xml) {
                DWZ.frag["pagination"] = $(xml).find("#pagination").text();
            }
        });
    }
};